package com.tbit.main.service.impl;

import com.tbit.main.dao.core.BatteryGroupBoundDao;
import com.tbit.main.dao.core.BatteryGroupDao;
import com.tbit.main.pojo.BatteryGroup;
import com.tbit.main.service.BatteryGroupService;
import com.tbit.main.util.DateTimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author LMY
 * @create 2022-05-03 16:06
 */
@Service("/batteryGroupService")
public class BatteryGroupServiceImpl implements BatteryGroupService {

    @Autowired
    private BatteryGroupDao batteryGroupDao;
    @Autowired
    private BatteryGroupBoundDao batteryGroupBoundDao;

    @Override
    public void add(BatteryGroup batteryGroup) {
        batteryGroup.setAddTime(DateTimeUtil.getNowTime());
        batteryGroupDao.add(batteryGroup);
    }

    @Override
    public void del(Integer id) {

        batteryGroupDao.del(id);

        batteryGroupBoundDao.del(id);
    }

    @Override
    public BatteryGroup getId(Integer id) {
        return batteryGroupDao.getId(id);
    }

    @Override
    public void getUpdate(Integer id, Integer accountUserId) {
        batteryGroupDao.getUpdate(id, accountUserId);
    }

    @Override
    public List<BatteryGroup> getAccountId(Integer accountId) {
        return batteryGroupDao.getAccountId(accountId);
    }

    @Override
    public List<BatteryGroup> getType(Integer type, String addTime) {
        return batteryGroupDao.getType(type, addTime);
    }

    @Override
    public List<BatteryGroup> getNOExt() {
        return batteryGroupDao.getNOExt();
    }
}
